# -*- coding: utf-8 -*-
# @Time : 2020/4/1 16:41
# @Author : hlikex
# @File : Run.py
from Login import Login
from Reply import Reply
from Dial import Dial
import logging
import time
class Run:

    def __init__(self):
        # 初始化读入QQ邮箱账号
        self.Users = []
        logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        self.logger = logging.getLogger(__name__)
        with open('User.txt', 'r') as f:
            for line in f:
                self.Users.append(line.strip("\n").split("----"))

    def Run(self):
        flag = 0
        for User,Pass in self.Users:
            # 实例化登入
            L = Login()
            driver = L.get_login(User,Pass,"")
            if driver != None:
                # 初始化回复
                R = Reply(driver)
                # 开始回复
                R.RetrieveEmail()
            flag +=1
            # 拨号
            if flag == 5:
                # Dial()
                flag = 0

        self.logger.info("全部执行完毕 ！！！")

if __name__ == '__main__':
    Run().Run()